﻿<UserControl x:Class="Microsoft.Research.Provenance.Controls.View.WorkflowDataProductView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Height="Auto" Width="Auto" MaxHeight="300" AutomationProperties.Name="AIDWorkFlowDataproductView">
    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="../ProvenanceControlResources.xaml" ></ResourceDictionary>
            </ResourceDictionary.MergedDictionaries>
        <BooleanToVisibilityConverter x:Key="boolToVisibilty"/>
        <DataTemplate x:Key="DataProductTemplate">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="20"/>
                    <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>
                <Image Source="{Binding Path=ImageSource}" Width="18" Height="18" Margin="0,0,5,0" MouseLeftButtonDown="OnLinkClick" Cursor="Hand"/>
                <TextBlock HorizontalAlignment="Left" VerticalAlignment="Center" Text="{Binding Path=Name}" 
                           TextDecorations="Underline" Foreground="Blue" MouseLeftButtonDown="OnLinkClick" Cursor="Hand"
                           TextWrapping="Wrap" Grid.Column="1" Margin="4,0,0,0" AutomationProperties.Name="{Binding Path=Name}"/>
			</Grid>
        </DataTemplate>
        </ResourceDictionary>
    </UserControl.Resources>

    <Expander Expanded="OnExpanded" Header="Data Products" Style="{DynamicResource ExpanderStyle2}" FontSize="12" Margin="10,10,10,10" IsExpanded="{Binding Path=IsExpanded}" AutomationProperties.Name="ANameWFDataProductExpander" >
        <Border BorderBrush="#FFC8C8C8" BorderThickness="1,0,1,1" CornerRadius="0,0,5,5">
            <Border BorderBrush="#FFC8C8C8" BorderThickness="1,1,1,1" CornerRadius="5,5,5,5" Margin="5,5,5,5">
                <Grid>
                    <Border>
                        <Grid>
                            <Border BorderBrush="Transparent" Visibility="{Binding Converter={StaticResource boolToVisibilty}, Path=DoesNotContainItems}">
                                <TextBlock Margin="5,5,5,5" Text="No data product(s) available."/>
                            </Border>
                            <Grid Visibility="{Binding Converter={StaticResource boolToVisibilty}, Path=ContainItems}" Height="230">
                                <Border BorderThickness="0">
                                    <ListBox Height="220" VerticalAlignment="Center" BorderBrush="#FFC8C8C8"
                                             IsSynchronizedWithCurrentItem="True" 
                                             ItemTemplate="{StaticResource DataProductTemplate}" 
                                             x:Name="DataProductList" 
                                             ItemsSource="{Binding Path=DataProductItemCollection}"/>
                                </Border>
                            </Grid>
                        </Grid>
                    </Border>
                </Grid>
            </Border>
        </Border>
    </Expander>

</UserControl>
